﻿Public NotInheritable Class frmSplashScreen
    Public Shared SplScreen As frmSplashScreen




    Private Sub frmSplashScreen_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown, btnCoWStarten.KeyDown, btnScriptEditor.KeyDown
        Select Case e.KeyCode

        End Select
    End Sub
    'TODO: Dieses Formular kann einfach als Begruessungsbildschirm fuer die Anwendung festgelegt werden, indem Sie zur Registerkarte "Anwendung"
    '  des Projekt-Designers wechseln (Menue "Projekt", Option "Eigenschaften").


    Private Sub frmSplashScreen_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        SplScreen = Me
        Me.ShowInTaskbar = False
        Me.Visible = False
        DataSettings.MySettingsIniLoad()
        Hauptmenue.CreateRessourcePath()

        'Richten Sie den Dialogtext zur Laufzeit gemaess den Assemblyinformationen der Anwendung ein.  
        'TODO: Passen Sie die Assemblyinformationen der Anwendung im Bereich "Anwendung" des Dialogfelds fuer die 
        '  Projekteigenschaften (im Menue "Projekt") an.

        'Anwendungstitel
        If My.Application.Info.Title <> "" Then
            ApplicationTitle.Text = My.Application.Info.Title
        Else
            'Wenn der Anwendungstitel fehlt, Anwendungsnamen ohne Erweiterung verwenden
            ApplicationTitle.Text = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName)
        End If

        'Verwenden Sie zum Formatieren der Versionsinformationen den Text, der zur Entwurfszeit in der Versionskontrolle festgelegt wurde, als
        '  Formatierungszeichenfolge. Dies ermoeglicht ggf. eine effektive Lokalisierung.
        '  Build- und Revisionsinformationen koennen durch Verwendung des folgenden Codes und durch Aendern 
        '  des Entwurfszeittexts der Versionskontrolle in "Version {0}.{1:00}.{2}.{3}" oder einen aehnlichen Text eingeschlossen werden. Weitere Informationen erhalten Sie unter
        '  String.Format() in der Hilfe.
        '
        '    Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor, My.Application.Info.Version.Build, My.Application.Info.Version.Revision)

        ' lblVersion.Text = System.String.Format(lblVersion.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor)
        lblVersion.Text = "Version: " + My.Application.Info.Version.ToString

        'Copyrightinformationen
        ' Copyright.Text = My.Application.Info.Copyright
        Select Case DataSettings.Sprache
            Case Sprachen.Deutsch
                btnCoWStarten.Text = btnCoWStarten.Text + " Starten"
                btnScriptEditor.Text = btnScriptEditor.Text + " Starten"
                btnHilfe.Text = "Hilfe!"
                btnBeenden.Text = "Beenden"
            Case Sprachen.English
                btnCoWStarten.Text = "Launch " + btnCoWStarten.Text
                btnScriptEditor.Text = "Launch " + btnScriptEditor.Text
                btnHilfe.Text = "Help!"
                btnBeenden.Text = "Quit"
        End Select

        If DataSettings.LobbyHost Then
            ObjektNetzwerkMenue.CreateNetzWerkLobby()
        End If

        Dim Dat As String = Environment.CommandLine.ToLowerInvariant.ToLower
        If Dat.Contains("-Editor".ToLowerInvariant.ToLower) Or Dat.Contains("Editor.exe".ToLowerInvariant.ToLower) Then
            startenSE()
        ElseIf Dat.Contains("-Game".ToLowerInvariant.ToLower) Or Dat.Contains("Game.exe".ToLowerInvariant.ToLower) Then
            StartenCW()
        End If
        Me.ShowInTaskbar = True
        Me.Visible = True
        'Hauptmenue.ComicalSheet("C:\Users\Tilman\Downloads\CO'S\Vlad+&+Ubel.png", , 2)
    End Sub


    Private Sub btnCoWStarten_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCoWStarten.Click
        StartenCW()
    End Sub

    Private Sub btnScriptEditor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnScriptEditor.Click
        startenSE()
    End Sub

    Sub StartenCW()

        Gestartet()

        Dim S As New Hauptmenue
        S.LoadForm()
    End Sub
    Sub startenSE()
        Gestartet()
        Dim S As New frmScriptWriter
        S.Show()
    End Sub
    Sub Gestartet()
        btnCoWStarten.Visible = False
        btnScriptEditor.Visible = False
        Me.ShowInTaskbar = False
        Me.Visible = False
    End Sub


    Private Sub btnHilfe_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHilfe.Click
        MessageBox.ShowMessageBox("Thats no big help file! But if CoW worked, and now you did something at the settings and now the game doesn't run anymore. (once I had the problem, that the Window was that little, that I couldn't change it in the option menu!) just run CoW with the parameter ""Reset"", or to reset and set everything to low quality, window mode, no music etc. ""ResetX"" If you don't know how to do that, just rename the ""CommanderWars.exe"" in ""Reset.exe"" or ""ResetX.exe"" this will work too.", MsgBoxStyle.Information, "how to reset settings")
    End Sub

    Private Sub btnBeenden_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBeenden.Click
        If Hauptmenue.Lobby IsNot Nothing Then
            Hauptmenue.Lobby.Connection.Close()
        End If
        Me.Close()
    End Sub


End Class
